fix: stop Chrome downloading an on-device model on every browser start - #29
fix: stop Chrome downloading an on-device model on every browser start#29alkaz-nodemaven wants to merge 1 commit into
Conversation
A fresh profile spends most of an idle window talking to optimizationguide-pa.googleapis.com, which serves the Optimization Guide's on-device model. Nothing in a scrape ever reads it, and a driver that opens a new profile per task pays for it every time. Measured over a 60 s window parked on about:blank, with a counting proxy attributing bytes per CONNECT authority: 45.2 MB before, 0.09 MB after. OptimizationHints is the master switch for the service; --disable-background- networking removes the component updater that accounts for the remaining 5.8 MB. Neither flag is visible to a page: 31 fingerprint probes covering navigator, window, WebGL, plugins and userAgentData are byte-identical with and without.
|
Flagging something against my own PR before anyone spends time merging it. After I opened this, SeleniumBase's maintainer pointed out that he had already What I have measured since, on Chrome 151.0.7922.137, Ubuntu 24.04.4, headful
12 of 12 started and reached a page, and bare But one platform and one build is not a refutation. His report is from when 151 Until that is settled, please treat the
Happy to push either version, or to close this and re-open once the 151 question |
What changed
Two entries in
default_argumentsinbotasaurus_driver/core/config.py:OptimizationHintsadded to the existing--disable-featureslist;--disable-background-networkingadded.A fresh Chrome profile spends an idle window downloading the Optimization
Guide's on-device model from
optimizationguide-pa.googleapis.com. Nothing in ascrape reads it, and a driver that opens a new profile per task pays for it on
every start - which for anyone running through a metered residential proxy is
billed traffic for a file no target ever sees.
Measurement
2026-08-25, Windows 10, Chrome 149.0.7827.201,
Driver(headless=True), 60 sparked on
about:blankwith nothing navigated. Bytes counted at a loopbackCONNECT proxy and attributed per authority, so these are socket bytes rather
than anything a page-level hook reported.
optimizationguide-pa.googleapis.comclients2.googleusercontent.commasterat db1d291, run 1masterat db1d291, run 2Each flag was isolated before either was proposed, on the same setup:
--disable-background-networking--disable-component-update--disable-features=OptimizationHints--disable-component-updateis the one that looks like it should help and doesnothing measurable, which is why it is not in this diff.
OptimizationHintsis the master switch for the service. The narrowerOptimizationHintsFetching,OptimizationTargetPredictionandOptimizationGuideModelDownloadingdo not work - I measured a library thatships all three on its command line and fetches 24-30 MB anyway.
A caveat on reading these numbers: the fetch does not fire on every start. Seven
of eight unflagged runs fetched and one was quiet, so one quiet run proves
nothing. Every row above is one of two runs and the flagged ones are quiet in
both.
Fingerprint
Neither flag is visible to a page. 31 probes sampled from
Driverwith andwithout them - the full
navigatorprototype property list (83 names), all 1232windowown-property names,plugins,mimeTypes, WebGL vendor, renderer andextension list,
userAgentData,Intl.resolvedOptions, screen metrics,PerformanceObserver.supportedEntryTypes- come back identical.--disable-background-networkingis already shipped by default in zendriver,SeleniumBase and Playwright, and patchright ships
OptimizationHints.Note on a related sharp edge
Config.browser_argsreturnssorted(self.default_arguments + self.arguments).Because Chrome honours only the last occurrence of a repeated switch, a user who
passes their own
--disable-features=...throughargumentseither wins or issilently ignored depending on where their string sorts against
--disable-features=IsolateOrigins,.... Merging into the existing list, as thisdiff does, avoids adding a second copy. Fixing the general case is a bigger
change and is not attempted here.